<br>
<br>
<div class="row">
    <div class="col-xs-12 col-md-12">
        <div class="grid simple">
            <div class="grid-body no-border">
                <form action="<?= DOMAIN.'admin/add' ?>" method="POST"> 
                    <div class="row">
                            <div class="row form-row">
                                <div class="col-xs-4 col-md-4">
                                    <label class="form-label">用户名</label>
                                    <input type="text" value="<?= $temp['username'] ?>" name="username" class="form-control" placeholder="只能包含英文或数字, 4~20位">
                                </div> 
                            </div>

                            <div class="row form-row">
                                <div class="col-xs-4 col-md-4">
                                    <label class="form-label">昵称</label>
                                    <input type="text" value="<?= $temp['nickname'] ?>" name="nickname" class="form-control" placeholder="最少1个字最多20个字">
                                </div> 
                            </div>

                            <div class="row form-row">
                                <div class="col-xs-6 col-md-6">
                                    <label class="form-label">邮箱</label>
                                    <input type="text" value="<?= $temp['email'] ?>" name="email" class="form-control" placeholder="example@email.com">
                                </div> 
                            </div>

                            <div class="row form-row">
                                <div class="col-xs-8 col-md-8">
                                    <label class="form-label">性别</label>
                                    <div class="radio">
                                        <? foreach($admin_gender as $k => $v): ?>
                                            <? if($temp['gender'] == $k): ?>
                                                <input type="radio" checked="checked" value="<?= $k ?>" name="gender" id="<?= $k ?>">
                                            <? else: ?>
                                                <input type="radio" value="<?= $k ?>" name="gender" id="<?= $k ?>">
                                            <? endif ?>
                                            <label for="<?= $k ?>"><?= $v ?></label>
                                        <? endforeach ?>
                                    </div> 
                                </div> 
                            </div>

                            <div class="row form-row">
                                <div class="col-xs-6 col-md-6">
                                    <label class="form-label">密码</label>
                                    <input type="password" value="<?= $temp['password'] ?>" name="password" class="form-control" placeholder="只能包含英文或数字, 6~20位">
                                </div> 
                            </div>

                            <div class="row form-row">
                                <div class="col-xs-6 col-md-6">
                                    <label class="form-label">确认密码</label>
                                    <input type="password" value="<?= $temp['confirm_password'] ?>" name="confirm_password" class="form-control" placeholder="请再次确认密码">
                                </div> 
                            </div>

                            <div class="row form-row">
                                <div class="col-xs-8 col-md-8">
                                    <label class="form-label">角色</label>
                                </div> 
                            </div> 

                            <div class="row form-row">
                                    <? if($role):?>
                                        <? foreach($role as $r):?>
                                        <div class="col-xs-3 col-md-3">
                                            <div class="checkbox check-success">
                                                <? $id = "role-{$r['role_id']}" ?>
                                                <? if(is_array($temp['role'])):?>
                                                    <input type="checkbox" value="<?= $r['role_id']?>" name="roles[]" id="<?= $id ?>" <?= in_array($r['role_id'],$temp['role']) ? 'checked="checked"':'' ?>>
                                                    <label for="<?= $id ?>"><?= $r['name']?></label>
                                                <? else: ?>
                                                    <input type="checkbox" value="<?= $r['role_id']?>" name="roles[]" id="<?= $id ?>">
                                                    <label for="<?= $id ?>"><?= $r['name']?></label>
                                                <? endif ?>
                                            </div>
                                        </div>
                                        <? endforeach ?>
                                    <? endif ?>
                            </div>
                    </div>
                      
                    <div class="form-actions">  
                        <div class="pull-left">
                            <button class="btn btn-success btn-cons" type="submit">
                                <i class="icon-save"></i>&nbsp;保存</button>
                            </button>
                            <button class="btn btn-white btn-cons" type="button" onclick="$.T.reset_form(this)">
                                重置
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>